﻿using SIE.SCADA.UICommon.AutoUI.UIAttribute;
using SIE.SCADA.UICommon.ViewModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIE.SCADA.ZemtDemo.ViewModel
{
    /// <summary>
    /// 工单信息类，缩进的工单AutoView的模型
    /// </summary>
    public class WoInfoViewModel : UIModel
    {
        public event EventHandler VersionChanged;
        public WoInfoViewModel()
        {

        }

        /// <summary>
        /// 
        /// </summary>
        [DisplayName("派工单号")]
        [ReadOnly(true)]
        public string WO
        {
            get { return _wo; }
            set
            {
                if (value != _wo)
                {
                    _wo = value;
                    OnPropertyChanged(nameof(WO));
                }
            }
        }
        private string _wo;


        /// <summary>
        /// KJF 20210407 新增
        /// </summary>
        [DisplayName("序列号")]
        [ReadOnly(true)]
        public string SN
        {
            get { return _sn; }
            set
            {
                if (value != _sn)
                {
                    _sn = value;
                    OnPropertyChanged(nameof(SN));
                }
            }
        }
        private string _sn;






        private string _disque;
        [DisplayName("派工工艺")]
        [Limitative(CanEdit = true)]
        [Required]
        public string Disque
        {
            get { return _disque; }
            set
            {
                if (value != _disque)
                {
                    _disque = value;
                    OnPropertyChanged(nameof(Disque));
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [DisplayName("MBOM")]
        [ReadOnly(true)]
        [Required]
        public string MBOM
        {
            get { return _MBOM; }
            set
            {
                if (value != _MBOM)
                {
                    _MBOM = value;
                    OnPropertyChanged(nameof(MBOM));
                }
            }
        }
        private string _MBOM;

        /// <summary>
        /// 
        /// </summary>
        [DisplayName("工艺流程")]
        [Limitative(CanEdit = true)]
        [Required]
        public string TechProcess
        {
            get { return _techProcess; }
            set
            {
                if (value != _techProcess)
                {
                    _techProcess = value;
                    OnPropertyChanged(nameof(TechProcess));
                }
            }
        }
        private string _techProcess;

        /// <summary>
        /// KJF 20210317 增加
        /// </summary>
        [DisplayName("工序编码")]
        [ReadOnly(false)]
        public string ProcessCode
        {
            get { return _processCode; }
            set
            {
                if (value != _processCode)
                {
                    _processCode = value;
                    OnPropertyChanged(nameof(ProcessCode));
                }
            }
        }
        private string _processCode;

        /// <summary>
        /// KJF 20210317 增加
        /// </summary>
        [DisplayName("工序名称")]
        [ReadOnly(false)]
        public string ProcessDesc
        {
            get { return _processDesc; }
            set
            {
                if (value != _processDesc)
                {
                    _processDesc = value;
                    OnPropertyChanged(nameof(ProcessDesc));
                }
            }
        }
        private string _processDesc;


        //public Dictionary<string, string> TechProcessSource { get; set; }


        /// <summary>
        /// 
        /// </summary>
        public Dictionary<string, string> TechProcessSource
        {
            get { return _TechProcessSource; }
            set
            {
                if (value != _TechProcessSource)
                {
                    _TechProcessSource = value;
                    OnPropertyChanged(nameof(TechProcessSource));
                }
            }
        }
        private Dictionary<string, string> _TechProcessSource;



        /// <summary>
        /// 
        /// </summary>
        [DisplayName("版本")]
        [Limitative(CanEdit = true)]
        public string JobstepVersion
        {
            get { return _JobstepVersion; }
            set
            {
                if (value != _JobstepVersion)
                {
                    _JobstepVersion = value;
                    OnPropertyChanged(nameof(JobstepVersion));
                    VersionChanged?.Invoke(null, null);
                }
            }
        }
        private string _JobstepVersion;

        public Dictionary<string, string> JobVersionSource
        {
            get { return _JobVersionSource; }
            set
            {
                if (value != _JobVersionSource)
                {
                    _JobVersionSource = value;
                    OnPropertyChanged(nameof(JobVersionSource));
                }
            }
        }
        private Dictionary<string, string> _JobVersionSource;



        /// <summary>
        /// 
        /// </summary>
        [DisplayName("产品编码")]
        [ReadOnly(false)]
        public string Code
        {
            get { return _code; }
            set
            {
                if (value != _code)
                {
                    _code = value;
                    OnPropertyChanged(nameof(Code));
                }
            }
        }
        private string _code;

        /// <summary>
        /// 
        /// </summary>
        [DisplayName("数量")]
        [ReadOnly(false)]
        public string PlanQuantity
        {
            get { return _PlanQuantity; }
            set
            {
                if (value != _PlanQuantity)
                {
                    _PlanQuantity = value;
                    OnPropertyChanged(nameof(PlanQuantity));
                }
            }
        }
        private string _PlanQuantity;

        public string ActualQuantity
        {
            get { return _ActualQuantity; }
            set
            {
                if (value != _ActualQuantity)
                {
                    _ActualQuantity = value;
                    OnPropertyChanged(nameof(ActualQuantity));
                }
            }
        }
        private string _ActualQuantity;



        
        [DisplayName("物料号")]
        [ReadOnly(true)]
        public string Matid
        {
            get { return _Matid; }
            set
            {
                if (value != _Matid)
                {
                    _Matid = value;
                    OnPropertyChanged(nameof(Matid));
                }
            }
        }
        private string _Matid;


        [DisplayName("产品号")]
        [ReadOnly(true)]
        public string Productid
        {
            get { return _Productid; }
            set
            {
                if (value != _Productid)
                {
                    _Productid = value;
                    OnPropertyChanged(nameof(Productid));
                }
            }
        }
        private string _Productid;


        [DisplayName("修程")]
        [ReadOnly(true)]
        public string RepairCode
        {
            get { return _RepairCode; }
            set
            {
                if (value != _RepairCode)
                {
                    _RepairCode = value;
                    OnPropertyChanged(nameof(RepairCode));
                }
            }
        }
        private string _RepairCode;


    }
}
